#region Using

using System;

#endregion

namespace XNgine.Input
{
    /// <summary>
    /// An input device event handler delegate. This defines the method
    /// signaturetype of input event handlers.
    /// </summary>
    /// <typeparam name="O">
    /// Type of input object that triggered the event (Key, Button, MouseButton,...)
    /// </typeparam>
    /// <typeparam name="S">
    /// Type of the state that event provides (MouseState, KeyboardState,...)
    /// </typeparam>
    /// <param name="sender">
    /// The object which trigered the event
    /// </param>
    /// <param name="e">
    /// InputDeviceArgs
    /// </param>
    public delegate void InputEventHandler<O, S>(object sender, InputDeviceEventArgs<O, S> e);

    /// <summary>
    /// An input device event argument class that can handle events
    /// for several types of input devices.
    /// </summary>
    /// <typeparam name="O">
    /// Type of input object that triggered the event (Key, Button, MouseButton,...)
    /// </typeparam>
    /// <typeparam name="S">
    /// Type of the state that event provides (MouseState, KeyboardState,...)
    /// </typeparam>
    public class InputDeviceEventArgs<O, S> : EventArgs
    {
        /// <summary>
        /// The object of type O that triggered the event 
        /// </summary>
        public O Object;

        /// <summary>
        /// The input device that manages the state of type S that
        /// owns the triggered object
        /// </summary>
        public InputDevice<S> Device;

        /// <summary>
        /// The state of the input device of type S that was triggered
        /// </summary>
        public S State;

        /// <summary>
        /// Constructor takes the triggered object and input device
        /// </summary>
        /// <param name="Object">The object that was triggered</param>
        /// <param name="Device">The InputDevice that registered the triggered object</param>
        public InputDeviceEventArgs(O Object, InputDevice<S> Device)
        {
            this.Object = Object;
            this.Device = Device;
            this.State = Device.State;
        }
    }
}